package com.bj.zspace;

import brave.grpc.GrpcTracing;
import com.bj.zspace.grpc.zipkin.ZipkinBraveTracing;
import com.bj.zspace.service.HelloServiceImpl;
import com.bj.zspace.service.TestServiceImpl;
import io.grpc.Server;
import io.grpc.ServerBuilder;

import java.io.IOException;

public class GrpcServer1 {

   // public static GrpcTracing grpcTracing = ZipkinBraveTracing.create("rpc-grpc-server");

    public static void main(String[] args) throws IOException, InterruptedException {
        // 1 绑定端口
        ServerBuilder serverBuilder = ServerBuilder.forPort(9999);
        //serverBuilder.intercept(grpcTracing.newServerInterceptor());
        // 2 发布服务
        serverBuilder.addService(new HelloServiceImpl());
        serverBuilder.addService(new TestServiceImpl());
        // 3 创建服务对象: ServerImpl
        Server server = serverBuilder.build();

        server.start();

        server.awaitTermination();

    }

}
